<template>
  <div class="app">
    <teleport to="#pengfan">
      <h2>当前计数:</h2>
      <button>+1</button>
      <hello-world></hello-world>
    </teleport>

    <teleport to="#pengfan">
      <span>哈哈哈</span>
    </teleport>
  </div>
</template>

<script>
import { getCurrentInstance } from "vue";
import HelloWorld from "./HelloWorld.vue";
export default {
  components: {
    HelloWorld,
  },
  setup() {
    const instance = getCurrentInstance();
    console.log(
      instance.appContext.config.globalProperties.$name,
      "teleport中的插件$name"
    );
  },
  mounted() {
    console.log(this.$name, "name");
  },
  methods: {
    foo() {
      console.log(this.$name);
    },
  },
};
</script>

<style scoped>
</style>